package com.hns.can.report.service;

import com.hns.can.master.vo.LeftOrgVo;
import com.hns.can.report.vo.QualityIndexParamVo;
import com.hns.can.report.vo.QualityIndexVo;
import com.hns.frame.mybatis.Pagination;
import com.hns.frame.service.CommonService;
import com.hns.tool.pub.PubUtil;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.HashMap;
import java.util.List;

/**
 * 质量指标Service
 * @author:zhangzq
 * @email:
 * @version Revision 2.0.0
 */
@Service
public class QualityIndexService extends CommonService {

    @Transactional
    public List<LeftOrgVo> getCarInfoList()throws Exception {
        HashMap<String,String> map = new HashMap<String,String>();
        map.put("userId",this.getCurrentUser().getUser().getId());
        List<LeftOrgVo> list = PubUtil.convertListMapToObject(sqlMapDao.selectList("qualityIndex.getCarInfoList", map), LeftOrgVo.class);
        return list;
    }
    
    @Transactional
    public List<LeftOrgVo> getLineInfoList() throws Exception{
    	HashMap<String,String> map = new HashMap<String,String>();
    	map.put("userId",this.getCurrentUser().getUser().getId());
    	List<LeftOrgVo> list = PubUtil.convertListMapToObject(sqlMapDao.selectList("qualityIndex.getLineInfoList", map),LeftOrgVo.class);
    	return list;
    }

    @Transactional
    public Pagination searchQualityIndexPage(QualityIndexParamVo vo) throws Exception {
        Pagination page = this.myBatisPage("qualityIndex.getQualityIndexCnt","qualityIndex.getQualityIndexList", vo, QualityIndexVo.class);
        return page;
    }

    @Transactional
    public List<QualityIndexVo> searchQualityIndexList(QualityIndexParamVo vo)throws Exception {
        List<QualityIndexVo> list = PubUtil.convertListMapToObject(sqlMapDao.selectList("qualityIndex.getQualityIndexList", vo), QualityIndexVo.class);
        return list;
    }

    /**
     * 车辆数据质量
     * @param vo
     * @return
     * @throws Exception
     */
    @Transactional
    public Pagination getdataQualityPage(QualityIndexParamVo vo) throws Exception {
        Pagination page = this.myBatisPage("qualityIndex.getdataQualityCnt","qualityIndex.getdataQualityList", vo, QualityIndexVo.class);
        return page;
    }
}
